{% extends 'admin/base.html' %}

{% block main %}
<body class="layui-layout-body">
<div class="layui-fluid">
  <div class="layui-row layui-col-space10">
    <div class="layui-col-lg12">
      <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>编辑文章</legend>
      </fieldset>
    </div>
  </div>
  <div class="layui-row layui-col-space10">
    <form class="layui-form layui-form-pane" action="" method="post">
      {{ post_new_form.csrf_token }}
      <div class="layui-col-lg8">

        <div class="layui-form-item">
          <label class="layui-form-label">文章标题</label>
          <div class="layui-input-block">
            {{ post_new_form.title(class="layui-input",placeholder="请输入文章标题") }}
          </div>
        </div>
        <div class="layui-form-item layui-form-text">
          <label class="layui-form-label">文章摘要
          </label>
          <div class="layui-input-block">
            {{ post_new_form.excerpt(class="layui-textarea",placeholder="请输入摘要") }}
          </div>
        </div>
        <div class="layui-form-item layui-form-text">
          <label class="layui-form-label">文章内容</label>
          <div class="layui-input-block">
            {{ post_new_form.content(class="ckeditor layui-textarea",placeholder="请输入内容") }}
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit="">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">保存草稿</button>
          </div>
        </div>

      </div>
      <div class="layui-col-lg4">
        <div class="layui-form-item">
          <label class="layui-form-label">文章分类</label>
          <div class="layui-input-block">
            <select name="interest" lay-filter="aihao">
              <option value=""></option>
              <option value="0">写作</option>
              <option value="1" selected="">阅读</option>
              <option value="2">游戏</option>
              <option value="3">音乐</option>
              <option value="4">旅行</option>
            </select>
          </div>
        </div>
        <div class="layui-form-item" pane="">
          <label class="layui-form-label">发布</label>
          <div class="layui-input-block">
            <input type="radio" name="sex" value="男" title="男" checked="">
            <input type="radio" name="sex" value="女" title="女">
          </div>
        </div>

      </div>
    </form>
  </div>
</div>
{% endblock %}
{% block script %}
{{ super() }}
<script src="{{ url_for('static', filename='ckeditor/ckeditor.js') }}"></script>
{#
<script>#}
    {#        // 用CKEditor替换<textarea id="content">#}
    {#        CKEDITOR.replace('content',#}
    {#            {#}
    {#                config.filebrowserUploadUrl = '/media/file/'; //文件上传路径。若设置了，则上传按钮会出现在链接、图片、Flash对话窗口#}
    {#                config.filebrowserImageUploadUrl = '/media/image/'; // 图片上传路径。若不设置，则使用filebrowserUploadUrl值#}
    {#                config.filebrowserFlashUploadUrl = '/media/flash/'; // Flash上传路径。若不设置，则使用filebrowserUploadUrl值。#}
    {##}
    {#            });#}
    {#
</script>
#}
{% endblock %}

{{ ckeditor.load(custom_url=url_for('static', filename='ckeditor/ckeditor.js')) }}
{{ ckeditor.config(name='content') }}